namespace SinaFinance
{
    using SinaFinance.SummaryInfoLibrary;
    using System;
    using System.Diagnostics;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Shapes;

    public partial class OfflinePage : UserControl
    {
        //private bool _contentLoaded;
        //internal Canvas BasicInfoCanvas;
        //internal Grid BottomGrid;
        //internal Grid LayoutRoot;
        //internal Rectangle rect;
        //internal Grid top;
        //internal Grid top2;
        //internal Canvas topInfoCanvas;

        public OfflinePage()
        {
            this.InitializeComponent();
            base.Loaded += new RoutedEventHandler(this.OfflinePage_Loaded);
        }

        //[DebuggerNonUserCode]
        //public void InitializeComponent()
        //{
        //    if (!this._contentLoaded)
        //    {
        //        this._contentLoaded = true;
        //        Application.LoadComponent(this, new Uri("/SinaFinance;component/OfflinePage.xaml", UriKind.Relative));
        //        this.LayoutRoot = (Grid) base.FindName("LayoutRoot");
        //        this.top = (Grid) base.FindName("top");
        //        this.rect = (Rectangle) base.FindName("rect");
        //        this.topInfoCanvas = (Canvas) base.FindName("topInfoCanvas");
        //        this.top2 = (Grid) base.FindName("top2");
        //        this.BasicInfoCanvas = (Canvas) base.FindName("BasicInfoCanvas");
        //        this.BottomGrid = (Grid) base.FindName("BottomGrid");
        //    }
        //}

        private void OfflinePage_Loaded(object sender, RoutedEventArgs e)
        {
            TopStockView view = new TopStockView();
            view.LoadLocalFile();
            this.topInfoCanvas.Children.Add(view);
            if (!view.LoadLocalFileSuccessfully)
            {
                this.top.Visibility = Visibility.Collapsed;
            }
            StockBasicInfo info = new StockBasicInfo();
            info.LoadLocalFile();
            this.BasicInfoCanvas.Children.Add(info);
            if (!info.LoadLocalFileSuccessfully)
            {
                this.top2.Visibility = Visibility.Collapsed;
            }
        }
    }
}
